home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
lisp
/
eulisp
/
mpfeel.lha
/
MPFeel
/
Plurals
/
mp_utils.m
< prev
next >
Wrap
Text File
|
1992-05-12
|
3KB
|
120 lines
/*
* Plurals
*
* Author: S.C.Merrall
*
* File: mp_utils.m
*
* Contents: sp_memcpy
* pp_memcpy
*
* Description: Functions that I feel should be in th mpl library
* but aren't.
*
* Change History:
*
* Date Name Comment
* -------- ---- -------
* 22:02:91 SCM Created
*/
#include <stdio.h>
#include "mp_debug_off.h"
/*----------------------------------------------------------------------------*
* Function : sp_memcpy
*
* Parameters : plural char *to: locations on PEs to copy to
* char *from: location on ACU to copy from
* int n: how much to copy
*
* Description: Same as memcpys all over the world except this copies from
* the ACU to DPU.
*
* Result : plural char *: locations on the PEs copied to
*---------------------------------------------------------------------------*/
#ifdef __STDC__
plural char plural *sp_memcpy( plural char *plural to, char *from, int n )
#else
plural char *plural sp_memcpy( to, from, n )
plural char *plural to;
char *from;
int n;
#endif
{
DBG_CALL("sp_memcpy");
DBG_NULL(from);
DBG_ARGS(fprintf(dbg,"to=????, from=%lx, n=%d",from,n));
for ( ; n > 0; --n) {
*to = *from;
++to;
++from;
}
DBG_EXIT(fprintf(dbg,"????"));
return to;
}
/*----------------------------------------------------------------------------*
* Function : pp_memswp
*
* Parameters : plural char *plural dest: Where the block goes
* plural int procids: Which processor the block is on
* plural char *plural from: Where the block is
* plural int size: How big the block is
*
* Description: Copies blocks of memory between processors, the blocks may
* be located at the same address without this causing any
* interference. Size and from refer to the same PE's
*
* Result : plural char *plural: The destination address
*---------------------------------------------------------------------------*/
#ifdef __STDC__
plural char *plural pp_memswp( plural char *plural dest, plural int procids,
plural char *plural from, plural int size )
#else
plural char *plural pp_memswp( dest, procids, from, size )
plural char *plural dest;
plural int procids;
plural char *plural from;
plural int size;
#endif
{
plural char tmp;
int i;
plural int remote_sizes;
DBG_CALL("pp_memswp");
DBG_ARGS(fprintf(dbg,"dest=????, from=????, size=????"));
remote_sizes = router[procids].size;
i = 0;
while( i < remote_sizes ) {
tmp=router[procids].(*(from + i));
*(dest + i) = tmp;
i++;
}
DBG_EXIT(fprintf(dbg,"????"));
return dest;
}